﻿#region Copyright Statement
//  ------------------------------------------------------------------------------
//  
//    This file is part of The Streambolics Library.
//    Copyright © 2005-2009, Stephan Leclercq & Streambolics
//    All rights reserved.
//  
//    The Streambolics Library is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//  
//    The Streambolics Library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//  
//    You should have received a copy of the GNU General Public License
//    along with Streambolics; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//  
//  ------------------------------------------------------------------------------
#endregion

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Streambolics.PtBurn.Gui
{
    public partial class PtBurnJobsList : UserControl
    {
        public PtBurnJobsList ()
        {
            InitializeComponent ();
        }

        public void Display (IEnumerable<PtBurnJob> aJobs)
        {
            listView_Jobs.Items.Clear ();
            foreach (PtBurnJob j in aJobs)
            {
                ListViewItem it = listView_Jobs.Items.Add (j.Name);
                it.Tag = j;
                it.SubItems.Add (j.StatusText);
                it.SubItems.Add (j.DiscsAhead.ToString ());
                it.SubItems.Add (j.CurrentStatus);
            }
        }

        private void listView_Jobs_DoubleClick (object sender, EventArgs e)
        {
            ListViewItem l = listView_Jobs.FocusedItem;
            if (l != null)
            {
                PtBurnJob j = (PtBurnJob)l.Tag;
                if (j != null)
                {
                    PtBurnJobDetailDialog.Show (j);
                }
            }
        }

    }
}
